#ifndef  __I2C_H_
#define  __I2C_H_

#include <Arduino.h>
#include <Wire.h>

class LMI {
public:
    int32_t I2C_Byte{};
    uint8_t scl;
    uint8_t sda;
    TwoWire *wire;

    LMI(uint8_t _scl, uint8_t _sda);

    int read(uint8_t id, float *temp, float *press);

    void IIC_Initial() const;

    void BSP_IIC_Start(uint8_t) const;

    void BSP_IIC_Stop() const;

    void BSP_IIC_ByteWrite(uint8_t dat) const;

    void BSP_IIC_ByteRead(char lByte, char ack);

    void SCL_SetOutput() const { pinMode(scl, OUTPUT_OPEN_DRAIN); }

    void SCL_SetVal() const { digitalWrite(scl, HIGH); }

    void SCL_ClrVal() const { digitalWrite(scl, LOW); }

    void SDA_SetOutput() const { pinMode(sda, OUTPUT_OPEN_DRAIN); }

    void SDA_SetInput() const { pinMode(sda, INPUT); }

    void SDA_SetVal() const { digitalWrite(sda, HIGH); }

    void SDA_ClrVal() const { digitalWrite(sda, LOW); }

    uint8_t SDA_GetVal() const { return digitalRead(sda); }
};


#endif